<?php defined('SEJUJOPEFDNGJSL') or exit('Access denied');?>
<?php
if(empty($_SESSION["checkscode"])||!strstr($_SESSION["checkscode"],'myinfo')){
    $_GET["m"]="myinfo";
    @require(ROOTTHEMETEMP."checkscode.inc.php");
    exit;
}
?>
<script type="text/javascript" src="<?php echo SITETHEME;?>js/reg.js"></script>
<script type="text/javascript" src="<?php echo SITETHEME;?>js/tip.js"></script>
<script type="text/javascript" src="<?php echo SITETHEME;?>js/checkreg.js"></script>

<?php require("topbut.php") ?>
<div class="panel panel-inverse">
    <div class="panel-heading">
        <h4 class="panel-title">个人资料</h4>
    </div>
    <div class="panel-body">
        <form class="form-horizontal" action="control.php" method="post">
        	<input type="hidden" name="act" value="modinfo" />
            <div class="form-group">
                <label class="col-md-3 control-label ui-sortable">账号</label>
                <div class="col-md-9 ui-sortable">
                    <input class="form-control" value="<?php echo $r['uname']?>" disabled="disabled" type="text">
                </div>
            </div>
            <!-- <div class="form-group">
                <label class="col-md-3 control-label ui-sortable">姓名</label>
                <div class="col-md-9 ui-sortable">
                    <input class="form-control" type="text" name="real_name" <?php if($r['real_name']){ echo 'disabled';}?> value="<?php echo $r['real_name']; ?>" />
                </div>
            </div>-->
            <div class="form-group">
                <label class="col-md-3 control-label ui-sortable">注册日期</label>
                <div class="col-md-9 ui-sortable">
                    <input class="form-control" value="<?php echo formatdate($r['regist_time'],1)?>" disabled="disabled" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label ui-sortable">推荐人</label>
                <div class="col-md-9 ui-sortable">
                    <input class="form-control" value="<?php echo $member->getuserid($r['introducer_id']); ?>" disabled="disabled" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label ui-sortable">手机号</label>
                <div class="col-md-7 ui-sortable">
                    <input class="form-control" value="<?php echo $r['phone']?>" disabled="disabled" type="text">
                </div>
                <div class="col-md-2 ui-sortable">
                    <a href="javascript:void(0)" onclick="sendsems()" class="btn btn-primary">修改手机号</a>
                </div>
            </div>
            <input type="hidden" name="ptd[]" value="rgweixin" />
            <div class="form-group" style="display:none">
                <label class="col-md-3 control-label ui-sortable">微信</label>
                <div class="col-md-9 ui-sortable">
                    <input class="form-control" type="text" name="rgweixin" value="<?php echo $r['rgweixin']; ?>">
                </div>
            </div>
            <!-- <div class="form-group">
                <label class="col-md-3 control-label ui-sortable">转出钱包地址</label>
                <div class="col-md-9 ui-sortable">
                    <input class="form-control" type="text" name="bgy_address" value="<?php echo $r['bgy_address']; ?>" <?php if($r['bgy_address']){ echo 'disabled';}?>>
                    <p  style="color: red;">请填写币股园电子钱包地址(已经填写不允许修改)</p>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-3 control-label ui-sortable">转入钱包地址</label>
                <div class="col-md-7 ui-sortable">
                    <input class="form-control" type="text" id="xfb_address" name="xfb_address" value="<?php echo $r['xfb_address']; ?>"<?php if($r['xfb_address']){ echo "readonly='readonly'";}?>>
                    <p  style="color: red;">用户申请后，系统会分配唯一且不能修改的接收赞币的地址</p>
                </div>
                <div class="col-md-2 ui-sortable">
                    <?php if(empty($r['xfb_address'])){?>
                        <input type="button" id="bask" value="申请赞币钱包地址" onclick="askfor()" class="btn btn-success">
                    <?}?>
                </div>

            </div>
            <div class="form-group">
                <label class="col-md-3 control-label ui-sortable">BTC转入钱包地址</label>
                <div class="col-md-7 ui-sortable">
                    <input class="form-control" type="text" id="btc_address" name="btc_address" value="<?php echo $r['btc_address']; ?>"<?php if($r['btc_address']){ echo "readonly='readonly'";}?>>
                    <p  style="color: red;">用户申请后，系统会分配唯一且不能修改的接收BTC的地址</p>
                </div>
                <div class="col-md-2 ui-sortable">
                    <?php if(empty($r['btc_address'])){?>
                        <input type="button" id="btc_bask" value="申请BTC钱包地址" onclick="askfor_btc()" class="btn btn-success">
                    <?}?>
                </div>

            </div>
            <div class="form-group">
                <label class="col-md-3 control-label ui-sortable">LTC转入钱包地址</label>
                <div class="col-md-7 ui-sortable">
                    <input class="form-control" type="text" id="ltc_address" name="ltc_address" value="<?php echo $r['ltc_address']; ?>"<?php if($r['ltc_address']){ echo "readonly='readonly'";}?>>
                    <p  style="color: red;">用户申请后，系统会分配唯一且不能修改的接收LTC的地址</p>
                </div>
                <div class="col-md-2 ui-sortable">
                    <?php if(empty($r['ltc_address'])){?>
                        <input type="button" id="ltc_bask" value="申请LTC钱包地址" onclick="askfor_ltc()" class="btn btn-success">
                    <?}?>
                </div>

            </div> -->
            <div class="form-group">
                <label class="col-md-3 control-label ui-sortable"></label>
                <div class="col-md-9 ui-sortable">
                    <button type="submit" class="btn btn-md btn-warning" <?php echo $r['can_modify_info']?"disabled":""?>>修改</button>
                </div>
            </div>
        </form>
        <script type="text/javascript" src="/public/home/js/layer/layer.js"></script>
        <script type="text/javascript">
        function askfor(){
           // $('#xfb_address').val('gsaiydfQDBLCVSFpdhpcbagfpgfasb');
           // $('#bask').hide();
            $.ajax({
            type: "post",
            url: "ajax.php?act=getaddress",
            dataType: "json",
            data:{"order_no":''},
            success: function(data){
                if (data.status) {
                   $('#xfb_address').val(data.mes);
                   $('#bask').hide();
                } else {
                    layer.alert(data.mes);
                }
            },
            error: function(){}
        });
        }
        function askfor_btc(){
           // $('#xfb_address').val('gsaiydfQDBLCVSFpdhpcbagfpgfasb');
           // $('#bask').hide();
            $.ajax({
            type: "post",
            url: "ajax.php?act=getaddress_btc",
            dataType: "json",
            data:{"order_no":''},
            success: function(data){
                if (data.status) {
                   $('#btc_address').val(data.mes);
                   $('#btc_bask').hide();
                } else {
                    layer.alert(data.mes);
                }
            },
            error: function(){}
        });
        }
        function askfor_ltc(){
           // $('#xfb_address').val('gsaiydfQDBLCVSFpdhpcbagfpgfasb');
           // $('#bask').hide();
            $.ajax({
            type: "post",
            url: "ajax.php?act=getaddress_ltc",
            dataType: "json",
            data:{"order_no":''},
            success: function(data){
                if (data.status) {
                   $('#ltc_address').val(data.mes);
                   $('#ltc_bask').hide();
                } else {
                    layer.alert(data.mes);
                }
            },
            error: function(){}
        });
        }
        </script>
    </div>
</div>
<div class="sendsms" style="display:none;">
    <div class="smsbox">
        <div class="smsiptbox">
            <label>手机号</label>
            <input type="text" value="<?php echo $r['phone'];?>" readonly>
            <input type="button" onclick="sendyzcode()" value="发送" class="btn btn-sm btn-primary" />
        </div>
        <div class="smsiptbox">
            <label>手机验证码</label>
            <input type="text" name="smscode" id="smscode" value="" />
        </div>
        <div class="smsiptbox">
            <label>新手机号</label>
           <input type="text" id="sphone" name="sphone" value="" class="sendipt" />
        </div>
        <div class="butbox">
            <input type="button" id="cphone" name="cphone" onclick="changephones()" value="修改" class="btn btn-success" style="width: 180px;margin-left: 155px;" />
        </div>
        <script type="text/javascript">
         function sendyzcode(){
            var phone=<?php echo !empty($r['phone'])?$r['phone']:0;?>;
            if(phone==''){
                alert('手机号为空！');
                return;
            }
            $.ajax({
                type: "get",
                dataType: "json",
                url: "/plus/sendsms.php?phone="+phone,
                success: function(data){
                    layer.alert(data.res);
                },
                error: function(){
                },
                cache: false,
                async: false
            });
        }
        function changephones(){
            var phone=$("#sphone").val();
            var code=$("#smscode").val();
            if(code==''){
                layer.alert("请输入验证码!");
                return;
            }
            if(phone==''){
                layer.alert("请输入您要更改的手机号码!");
                return;
            }
            var status=0;
            $.ajax({
                type: "get",
                dataType: "json",
                url: "ajax.php?act=changephone&phones="+phone+"&pcode="+code,
                success: function(data){
                    if(data.status==0){
                        layer.alert(data.res);
                    }else{
                        layer.alert(data.res);
                        layer.closeAll();
                        location.reload();

                    }
                },
                error: function(){
                },
                cache: false,
                async: false
            });

        }
    </script>

    </div>
</div>

<script type="text/javascript">
   function sendsems(){
        layer.closeAll();
        layer.open({
            type: 1,
            title: ['修改手机号', 'font-size:14px;color:#333;font-weight:900;'],
            skin:"sendbg",
            area: ['518px', '213px'],
            closeBtn: 2,
            shift: 2,
            fix: 0,
            shade: 0,
            anim: 2,
            shadeClose: false,
            content: $('.sendsms'),
            // success: function(layero, index){
            // 	layer.style(index, {
            // 	    top:160
            // 	});
            //   }
            offset: ['20px','315px'],
        });
        return false;
    }

</script>
